# FontForge install procedures
for the macintosh

- Installing from a pre-built mac package
  - Before you install
  - Obtaining one of my pre-built packages
  - Installing
  - Notes
- Before you build (on a mac)
- Building and installing from source
  - Obtaining a source distribution
    - tarball
    - from the cvs tree
  - Building & installing it
  - More complicated installs
- Dependencies (external libraries/helper programs)
- Suggested fonts
- Installing documentation
  - Installing a documentation tarball
- Some notes on the PATH variable.
- Running FontForge
- Reporting Bugs

## Installing from a pre-built package

### Before you install

You must ensure that you have the X11 server installed on your system.

10.5, 10.4
  - Open the Install DVD that came with your system.
  - Scroll down to "Optional Installs" and open it.
  - Keep clicking `Continue` until you get to the pane "Custom Install on "Macintosh HD""
  - Press the arrow beside "Applications" so you get a list of them.
  - Select X11
  - Keep pressing `Continue`

  - Apple appears to have shipped a buggy version of X11 with 10.5. The problem appears fixed in 10.5.6 (It may have been fixed earlier, but I don't have a machine on which I can test).

    The problem only affects fontforge it if uses pango or cairo.

    This release of fontforge tries to check for a buggy system, and if it thinks it is running on one, then it will refuse to use Pango and Cairo.

    The problem does not affect Mac 10.4.*

    You may upgrade from 10.5 to 10.5.6 by going to the Apple Menu and selecting the "Software Update" menu item, and then the "Mac OS X Update Combined".

    You probably need to install X11 before you upgrade the Operating System.

10.3
  - The X server lives in a package called X11User.pkg in the Packages folder on the third install CD.
  - Just double click on this file and follow its instructions to install X11

You may also want to install the fink package or the equivalent from macports which includes many useful libraries (see the dependencies section below for more info on this)

#### Configuring X11

`X11->Preferences->Input`

FontForge is designed to make use of a three button mouse. It is also designed to make use of modifier key modes on mouse clicks (so Control left click can mean something different than left click). If you have a three (or two) button mouse then use it (and turn off "`Emulate three button mouse`" in the X11 preferences). If you have a standard one button mouse then you have the option of having the mac simulate a three button mouse (for instance Option mouse click behaves like clicking the middle mouse button). Unfortunately this means you can no longer use the Option key to change the behavior of the left (only) button click. So either choice means you lose capabilities.

Normally X11 is configured so that the Command key (cloverleaf) is bound to the X11 menu bar, and not to fontforge's. When fontforge starts it checks this, and if X11 gets command then fontforge configures its menubar to use Control rather than command. This isn't very mac-like. If you turn off the "`Enable keyboard shortcuts under X11`" preference item then fontforge will configure its menubar to make use of Command.

If type the following into a terminal (or xterm) window

>     $ cat >~/.fonts.conf
>     <?xml version="1.0"?>
>     <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
>     <!-- /etc/fonts/fonts.conf file to configure system font access -->
>     <fontconfig>

>     <!-- Font directory list -->
>     <!-- Add to system list -->

>             <dir>/System/Library/Fonts</dir>
>             <dir>/Library/Fonts</dir>
>             <dir>~/Library/Fonts</dir>

>     </fontconfig>
>     ^D

then fontforge's UI will be able to use the fonts Apple supplies with the mac. (You don't type the "$", and ^D means hold down the control key and press "D").

#### Note:

On the mac, the Option key is mapped to what fontforge calls "Alt" or "Meta".

### Obtaining one of my pre-built packages

I post mac install packages on sourceforge's file release system. There's a certain amount of pother involved in using the file release system, but you get the file eventually.

I currently post builds for Mac 10.5 & 10.4 (I post different builds for the two systems because they provide different python libraries).

Neither of these builds will work on 10.3. If you wish a 10.3 you can build from current source or find a build from 2006. If you wish a 10.2 or earlier build the current sources will not work and you must delve more deeply into the past.

- If you follow the link above you will end up on a page showing many releases of FontForge for many systems
  in most cases you will want the most recent release.
- Then click on the executable package you want to download:
  - The mac release will be called something like "FontForge-200xxxxx.pkg.sitx
- Then you have the joy of choosing a mirror site (pick one that's on the same continent you are) and click on the little icon in the download column
- Then you wait. After a bit you get another copy of this same page. After an even longer time your browser notices that you've started a download.

### Installing

Generally your browser will decompress the package after pulling it down, and then start the install process itself.

If this doesn't happen, find the package (it's usually on the desktop) and double-click on it.

The install will request your password (to make sure you have the right to do an install on your machine, and then ask some innocuous questions, and proceed to install.

### Notes

FontForge does not conform to Apple's Human Interface Guidelines. FontForge never will. Don't expect it to look like a normal Mac Application. It doesn't.

## Before you build (on a mac)

You must ensure that you have the both the X11 server and the Developer's toolchain installed on your system. This process is slightly different on OS/X 10.3 & 10.4

10.5, 10.4
  - Open the Install DVD that came with your system.
  - Scroll down to "Optional Installs" and open it.
  - Keep clicking `Continue` until you get to the pane "Custom Install on "Macintosh HD""
  - Press the arrow beside "Applications" so you get a list of them.
  - Select X11
  - Keep pressing `Continue`

  - The Developer's toolchain is optional software on the install DVD. Simply insert the disk and click on the XCode install icon.
10.3

- The X server lives in a package called X11User on the third install CD.
- You must also install the X11SDK package on the XCode CD
- And you must install the Developer's (XCode) tools themselves.

You may also want to install the fink package or the equivalent from macports which includes many useful libraries (see the dependencies section below for more info on this)

You must then start up a Terminal window (the Terminal Application also lives in the Utilities sub-folder of the Applications folder) and be prepared to type commands in that window (I know, it's very un-mac-like).

## Building and installing from source

### Obtaining a source distribution

There are two basic ways to obtain a source distribution. One is by downloading an entire source tree from the web, and the other is by using the cvs utility to maintain a source tree on your machine which will be as up to date as possible. The former solution provides more stability, the latter provides access to cutting edge bugs.

#### tarball

Sourceforge's file release system will contain a tarball (a file with the extension for .tar.bz2).

After you have downloaded one of these packages, either copy the tarball to where you are, or move to the directory containing the tarball (I can't provide explicit instructions here, because I don't know where your browser put the file) and type (The "$" or "#" are example prompts from the computer. Do not type them yourself):

>     $ bunzip2 fontforge*.tar.bz2
>     $ tar xf fontforge*.tar
>     $ cd fontforge-*

#### from the cvs tree

cvs is a nifty set of utilities which allows concurrent access to a source tree by many users. To set up your own (local) copy of the cvs tree (including documentation), create a new directory, cd into it and type the following (when it asks for a password, just hit return):

>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge login
>     CVS password:
>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge checkout fontforge
>     $ cd fontforge

Once you have established a directory you may update it to obtain the most recent version of the source by typing:

>     $ cd fontforge
>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge login
>     CVS password:
>     $ cvs -d:pserver:anonymous@cvs1.sourceforge.net:/cvsroot/fontforge update

You can also browse the CVS tree online. Or see sourceforge's description for more information (their information is out of date, the correct server is cvs1.sf.net not cvs.sf.net), or read the CVS manual.

### Building & installing it

Now you have the source installed on your system and you should be positioned at the top directory of that tree. You need to configure your package (this is a little program that figures out how to use your system), and then build it (do not type "$"):

>     $ ./configure
>     $ make

Having done this you will probably want to install what you have built. This should be done as root:

>     $ sudo make install
>     password: ******

### More complicated installs

The configure script allows you to turn off and on various features of fontforge that might not be appropriate for your system. Type

>     $ configure --help

for a complete list of options. Some of the most useful are described below.

#### Building fontforge without X

If you don't want to install X11 on your system, you can use fontforge as a command line tool which can execute scripts to manipulate fonts. FontForge supports python scripting and a legacy scripting language unique to ff which is described in detail in the section on scripting.

>     $ configure --without-x

#### Installing FontForge somewhere other than `/usr/local`

If you want to install fontforge in a different directory (say in /usr/bin)

>     $ configure --prefix=/usr

#### Installing documentation from the cvs tree

If you have a copy of the cvs tree on your system then you should be able to type

>     $ sudo make install_docs

## Dependencies (external libraries/helper programs)

FontForge tries to avoid hard dependencies. If a library is missing then fontforge will (in most cases) be able to continue to run, it will just lack whatever functionality the library provides. So if you don't need to import tiff images, you don't need libtiff. If you don't need to handle SVG fonts you don't need libxml2, etc.

With the appropriate libraries, FontForge can import png, tiff, and gif images to act as character backgrounds for tracing purposes (FontForge can import bmp and xbm formats without external libraries). With libxml2 FontForge can read SVG fonts. With the freetype library FontForge will do a better job making bitmap characters for you. libuninameslist provides standard unicode names and annotations for unicode characters (it has been localized into English and French)

None is required for the proper compilation/execution of FontForge, if the libraries are not present they will not be used. (If the machine on which your executable was build didn't have them, then you must not only install the libraries, but rebuild fontforge from source) If your machine doesn't have them and you want them they are available from:

- Image Libraries (to allow FontForge to import images in those formats)
  - libpng (and required helper zlib)
  - libtiff
  - libungif
  - libjpeg
- libxml2
  To parse SVG files and fonts
- libuninameslist
  To display unicode names and annotations.
- libiconv
  Only important for systems with no built-in iconv(). If not present FontForge contains a minimal version of the library which allows it to work. But if you want to use libiconv you must configure it with `--enable-extra-encodings`, as FontForge requires Shift-JIS.
- freetype
  To do a better job rasterizing bitmaps, and to enable the truetype debugger

  Some of FontForge's commands depend on your compiling freetype with the byte code interpreter enabled. This is disabled by default because it infringes on certain patents granted to Apple. If you have a license from Apple (or live in a country where these patents do not apply) then you may enable the interpreter by setting the appropriate macro in .../include/freetype/config/ftoption.h before you build the library (see the README.UNX file on the top level of the freetype distribution).

  To enable the truetype debugger, FontForge needs to have the freetype source directories available when it is built (there are some include files there which it depends on)

- libintl
  Is standard on most unixes. It is part of the fink package on the mac. Handles UI localization.
- libpython
  If present when FontForge is compiled, allows the user to execute python scripts within fontforge (and you can configure fontforge so that fontforge's functionality can be imported into python -- that is fontforge both extends and embeds python)

  This is one library that fontforge does not try to load at run time.

- libX
  Normally FontForge depends on the X11 windowing system, but if you are just interested in the scripting engines (with no user interface), it may be built on systems without X (the configure script should figure this out).
- libcairo
  Cairo handles drawing anti-aliased splines in the outline glyph view. It is dependent on libfontconfig, libXft and perhaps other libraries.
- libpango
  Pango draws text for complex scripts. It depends on glib-2.0, libfontconfig, libfreetype, libXft, and perhaps other libraries.
- Under Mac OS/X these libraries are available from the fink project and from macports.

  Sadly one important library is missing from fink's distributions for Mac X.5 (it is present in the X.4 distributions). I have bundled up all the (fink) libraries used by fontforge and provide them in a package of my own.

If you want to do autotracing around character images you should also download either

- Peter Selinger's potrace
- Martin Weber's autotrace program.

Normally FontForge depends on the X11 windowing system, but if you are just interested in the scripting engine (with no user interface), it may be built on systems without X (the configure script should figure this out).

Once upon a time, fontforge only used X11 bitmap fonts, on most systems in now uses fontconfig.

There seem plenty of good unicode outline fonts, so I shan't provide any suggestions. To install them you simply create a subfolder called .fonts in your home folder, and then copy the font file into that subdirectory. Warning: pango uses opentype to layout complex scripts. Most fonts on your macintosh are in a different format -- glyphs from them will display fine (so they work for latin, greek cyrillic, japanese, chinese, etc.) but more complex features will probably not work (so Arabic and Indic scripts may not be displayed properly).

In the old days there weren't many bitmap fonts with good unicode coverage so I provided a list of suggested fonts. That's not nearly as important now. If fontconfig isn't available for you, you might want to pull down some old unicode bitmap fonts.

- Kanou's fontview fonts
- The unifont
- ClearlyU's font
- The FreeFont project
- X fixed
- Computer Modern Unicode fonts
- Unicode Font Guide for Free/Libre Open Source Operating Systems

- FontForge's conventions for non-BMP unicode bitmap fonts

To install these, put them in a directory, and in that directory type:

>         $ mkfontdir
>         $ xset fp+ `pwd`

You should make sure that the xset line happens whenever X is started on your machine (put it in your .xsession file).

## Documentation

The complete fontforge manual is available online.

- There is a shorter tutorial which
  - Is available online
  - Can be downloaded as pdf
  - example files (to work through the tutorial yourself)
- A documentation tarball can be retrieved from the file release system
- The cvs tree contains a sub-directory called htdocs containing the manual
  - The cvs tree contains a sub-sub-directory called htdocs/ja containing the Japanese translation of the manual
- See the general comments on the cvs tree to see how to access this.
  See the section on installing cvs documentation to see how to install the docs from the cvs tree

### Installing a documentation tarball

Once you have downloaded the documentation tarball as described above, you should move to the directory containing it, and type:

>     $ sudo sh
>     password: ******
>     # mkdir -p /usr/local/share/doc/fontforge
>     # mv fontforge_htdocs*.tgz /usr/local/share/doc/fontforge
>     # tar xfz fontforge_htdocs*.tgz
>     # rm fontforge_htdocs*.tgz

After doing this fontforge will be able to find the docs on your system when you press the [F1] (or [Help]) key. If you don't do this fontforge will attempt to find documentation online.

## Starting FontForge

### On the mac

FontForge now installs itself as a mac application in the Applications folder. You can start FontForge the way you start any other application, double clicking on it, dragging files to it, etc.

Caveat: `FontForge` and `Font Book` may fight over which will open standard fonts if you double click on the font file. Both claim they can open these files, neither claims to be the prefered application for them. If an .otf file shows a fontforge icon it will be opened by fontforge, if a font book icon it will be opened by font book. Dragging a font file to the desired application will always work. Or you can select the font, and invoke `File->Get Info` (in the Finder's menu) and use the "Open with" control to select an application.

On the mac the Option key is used to invoke the functionality that fontforge's docs call "Alt" or "Meta". (See the section on X11 configuration for notes on three button mice and the command key).

You can also start fontforge using traditional unix methods

Before you start fontforge on the mac you must start the X11 server. You can do this by opening the Applications folder, and then opening the Utilities folder, and then double-clicking on "X11". (If you don't have X11 there then refer back to the instructions for installing it)

Having done that there should be a menubar with a menu labeled "Applications". Click on this. There should be a "FontForge" entry in it. Selection FontForge will start fontforge and bring up a dialog allowing you to open a font or create a new one.

Caveat: FontForge does not normally show mac resource fonts in this dialog -- however it can still open one even it it isn't displayed. Simply type in the name of the file containing it. (or change the Filter field to "All Files").

Caveat: Normally FontForge will never see the command key shortcuts. X11 intercepts these and uses them itself. If you would like to be able to use Command-Q to quit FontForge then

- Make sure the X11 menu bar is visible
- Select the menu item `X11->Preferences->Input`
- turn off (uncheck) `[] Enable keyboard shortcuts under X11`

Caveat: FontForge was written assuming the availability of a three button mouse. Under 10.4 X11 simulates this by creating a virtual three button mouse where the middle button is invoked by Option-Mouse click and the right button by Command-Mouse click. (You can also control this from X11->Preferences).

If the Applications menu does not contain a "FontForge" entry, you can add one yourself:

- Select Applications->Customize Menu
- Then press the (Add) button in the dialog that appears
- Double click in the left-most section of the blank line which just appeared and then type "FontForge"
- Press the [Tab] key and type "/usr/local/bin/fontforge"
- Press the [Tab] key again and type "f"
- Then press (Done)

(You may also start fontforge from the command line here. Go to the Applications menu and select Terminal or xterm, and look at the section after the next.

### Notes on the PATH variable

On most systems fontforge will install itself into `/usr/local/bin` (that's the standard place for optional software), and this is not always in the default search path for commands (grrrr). Which means you might have everything properly installed, but nothing actually works from the command line. If you see messages like `"fontforge: command not found."` this has (probably) happened to you.

So what do you do?

You need to set the PATH environment variable so that it includes /usr/local/bin. The value of the PATH variable is a set of directories separated by colons.

>     $ echo $PATH
>     /home/gww/bin:/usr/bin:/bin:/usr/X11R6/bin:/sbin

Unfortunately there are several ways of doing this because there are two different conventions used by unix shells. And the mac has yet a third way which only works sometimes. Type:

>     $ echo $SHELL
>     /bin/bash

If the name of your shell is `bash` (as above), `ksh` or `sh` then you want to type

>     $ PATH=/usr/local/bin:$PATH ; export PATH

If the name of your shell is `tcsh` or `csh` then you say

>     $ setenv PATH /usr/local/bin:$PATH

But you'd have to do that every time you logged in. Instead you want this included in the shell's initialization. Again there are two cases, for the `bash` family of shells you want to edit the file `~/.bashrc` while for the `csh` family you want to edit the file `~/.cshrc`. On a bash system the following command is generally sufficient:

>     $ cat >>~/.bashrc
>     PATH=/usr/local/bin:$PATH ; export PATH
>     ^D

(where `^D` represents control-D, obtained by holding down the control key while depressing `d`.
And for the csh family you would type:

>     $ cat >>~/.cshrc
>     setenv PATH /usr/local/bin:$PATH
>     ^D

On the mac you may also want to download the environment preference plugin and install the environment variable there. Note if you ssh into your mac this setting will not be noticed.

### Starting fontforge from the command line

> `$ fontforge font.pfa font2.sfd font3.ttf font4.otf`

will start fontforge looking at the fonts you specify on the command line. It can read either pfb or pfa fonts, and some ps fonts (type 0 fonts based on a type 1 dictionary) as well as truetype fonts, open type fonts and many other formats.

> `$ fontforge -new`

will cause fontforge to create a new font (in iso-8859-1 encoding)

> `$ fontforge`

will open up a file picker dialog and allow you to browse till you've found a font file (or have created a new one).

> `$ fontforge -script script.pe fonts...`

This will invoke fontforge in a non-interactive mode, and have it run the named script. Any further arguments on the command line will be passed as arguments to the script and processed (or not) by it.

## Reporting Bugs

Please report bugs by sending an e-mail to fontforge-devel@lists.sourceforge.net